import API from './api';
import http from '../plugin/http';
import type { RuleForm, ICourseItemDataModal } from '@/type';

const createCourse = async (params: RuleForm) => {
    return await http.post(API.COURSE_CREATE, params);
};

const queryCourses = async () => {
    return await http.get(API.COURSE_QUERYS);
};

const queryCourse = async (params: {
    id: string
}) => {
    return await http.get(API.COURSE_QUERY, {params});
};

const deleteCourse = async (params: ICourseItemDataModal) => {
    return await http.post(API.COURSE_DELETE, params);
};

const updateCourse = async (params: ICourseItemDataModal) => {
    return await http.post(API.COURSE_UPDATE, params);
};

export default {
    createCourse,
    queryCourses,
    deleteCourse,
    queryCourse,
    updateCourse,
}